import { Injectable } from '@angular/core';
import { HttpClient } from '../../../providers/httpClient';
import { Config } from '../../../providers/config';

@Injectable()
export class EmailListService {
	constructor(
		public httpClient: HttpClient,
		public config: Config
	) { }
	getListData(page, listType, condition) {
		let postBody = {
			"module": "Email",
			"method": "getMailInfByCondition",
			"params": {
				"listType": listType,
				"bostitle": condition.keyWord,
				"sendAccount": condition.addresser_id,
				"recipients": condition.recipients,
				"bDate": condition.startDate,
				"eDate": condition.endDate,
				"opraterLogid": "fengjk",
				"orderField": "mailbosid",
				"orderDirect": null,
				"page": page,
				"pageSize": this.config.pageSize
			}
		};
		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}
	// 获取邮件详情
	getDetailData(id) {
		let postBody;
		postBody = {
			"module": "Email",
			"method": "getMailInfoByBosid",
			"params": {
				"mailbosid": id,
				"logid": "fengjk"
			}
		};
		return this.httpClient.post(postBody);
	}
}
